import request from '@/utils/request'

// 获取路由
export const getRouters = () => {
  return request({
    url: '/getRouters/',
    method: 'get'
  })
};

// 获取菜单列表
export const getMenus = () => {
  return request({
    url: '/sysMenu/showMenuListByUserId',
    method: 'get'
  })
};

// 获取树菜单列表
export const getTree = () => {
  return request({
    url: '/sysMenu/getTree',
    method: 'get'
  })
};


// 新增菜单
export const addMenu = (form) => {
  return request({
    url: '/sysMenu/addMenu',
    method: 'POST',
    data:form
  })
};

// 修改菜单
export const updateMenu = (data) => {
  return request({
    url: '/sysMenu/updateMenu',
    method: 'PUT',
    data
  })
};

// 根据菜单id获取菜单信息
export const getMenuByMenuId = (menuId) => {
  return request({
    url: '/sysMenu/getMenuByMenuId/'+menuId,
    method: 'get'
  })
};

// 搜索菜单
export const search = (menuName) => {
  return request({
    url: '/sysMenu/search/'+menuName,
    method: 'get'
  })
};

// 删除菜单包括父级菜单
export const deleteMenuAdmin = (data) => {
  return request({
    url: '/sysMenu/deleteMenuAdmin',
    method: 'delete',
    data
  })
};

// 角色菜单中对话框中的权限菜单
export const getTreeMenu = () => {
  return request({
    url: '/sysMenu/getTreeMenu',
    method: 'get'
  })
};
